import api from './index'

interface Teacher {
  id?: number
  name: string
  employee_id: string
  class_time: string
  unavailable_time: string
  lives_in_weishui: boolean
}

export const teacherApi = {
  getTeachers: (): Promise<Teacher[]> => {
    return api.get('/teachers')
  },

  createTeacher: (teacher: Omit<Teacher, 'id'>): Promise<any> => {
    return api.post('/teachers', teacher)
  },

  updateTeacher: (id: number, teacher: Omit<Teacher, 'id'>): Promise<any> => {
    return api.put(`/teachers/${id}`, teacher)
  },

  deleteTeacher: (id: number): Promise<any> => {
    return api.delete(`/teachers/${id}`)
  }
}
